namespace TaskScheduler.Core;

/// <summary>
/// 任务调度器接口
/// </summary>
public interface ITaskScheduler
{
    /// <summary>
    /// 启动调度器
    /// </summary>
    /// <param name="cancellationToken">取消令牌</param>
    Task StartAsync(CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 停止调度器
    /// </summary>
    /// <param name="cancellationToken">取消令牌</param>
    Task StopAsync(CancellationToken cancellationToken = default);
    
    /// <summary>
    /// 添加任务
    /// </summary>
    /// <param name="task">任务</param>
    void AddTask(ITask task);
    
    /// <summary>
    /// 移除任务
    /// </summary>
    /// <param name="taskName">任务名称</param>
    void RemoveTask(string taskName);
    
    /// <summary>
    /// 获取所有任务
    /// </summary>
    /// <returns>任务列表</returns>
    IEnumerable<ITask> GetAllTasks();
    
    /// <summary>
    /// 手动执行任务
    /// </summary>
    /// <param name="taskName">任务名称</param>
    /// <param name="cancellationToken">取消令牌</param>
    /// <returns>执行结果</returns>
    Task<TaskResult> ExecuteTaskAsync(string taskName, CancellationToken cancellationToken = default);
} 